import 'package:flustars_flutter3/flustars_flutter3.dart';

import 'package:flutter_deer/generated/json/base/json_field.dart';
import 'package:flutter_deer/generated/json/employee_config.g.dart';

@JsonSerializable()
class EmployeeConfig {
  String key = '';
  bool open = false;
  bool pos = false;
  bool xcx = false;

  EmployeeConfig();

  factory EmployeeConfig.fromJson(Map<String, dynamic> json) => $EmployeeConfigFromJson(json);

  Map<String, dynamic> toJson() => $EmployeeConfigToJson(this);

  // 员工绩效 消费
  static const String EMPLOYEE_PERFORMANCE_ENERGY = 'EMPLOYEE_PERFORMANCE_ENERGY';

  // 员工绩效 储值
  static const String EMPLOYEE_PERFORMANCE_STORED = 'EMPLOYEE_PERFORMANCE_STORED';

  // 员工绩效 通付
  static const String EMPLOYEE_AT_WILL = 'EMPLOYEE_AT_WILL';

  // 保存消费
  static void saveEmployeeConfigEnergy(bool config) {
    SpUtil.putBool(EMPLOYEE_PERFORMANCE_ENERGY, config);
  }

  // 保存储值
  static void saveEmployeeConfigStored(bool config) {
    SpUtil.putBool(EMPLOYEE_PERFORMANCE_STORED, config);
  }

  // 保存通付
  static void saveEmployeeConfigAtWill(bool config) {
    SpUtil.putBool(EMPLOYEE_AT_WILL, config);
  }

  // 获取消费
  static bool getEmployeeConfigEnergy() {
    return SpUtil.getBool(EMPLOYEE_PERFORMANCE_ENERGY) == true;
  }

  // 获取储值
  static bool getEmployeeConfigStored() {
    return SpUtil.getBool(EMPLOYEE_PERFORMANCE_STORED) == true;
  }

  // 获取通付
  static bool getEmployeeConfigAtWill() {
    return SpUtil.getBool(EMPLOYEE_AT_WILL) == true;
  }
}
